package com.yexiong.test;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.common.entity.DataPack;
import com.common.entity.Event;
import com.common.entity.Student;
import com.yexiong.dao.impl.EventDaoImpl;
import com.zhongyong.server.dao.StudentDao;
import com.zhongyong.server.dao.impl.StudentDaoImpl;

public class textEvne {
	public static void main(String[] args) {
		Socket socket;
		try {
			socket = new Socket("127.0.0.1", 9900);
			ObjectOutputStream outputStream=new ObjectOutputStream(socket.getOutputStream());
			ObjectInputStream in=new ObjectInputStream(socket.getInputStream());
			DataPack dataPack=new DataPack();
			dataPack.setOptType("getStudent");
			dataPack.setOptClassName("com.zhongyong.server.process.StudentServiceProcess");
			outputStream.writeObject(dataPack);
			outputStream.flush();
			DataPack da=(DataPack)in.readObject();
			List<Student> list=(List<Student>)da.getCon();
			List<String> list2=new ArrayList<>();
			for (int i = 0; i < list.size(); i++) {
				Student student=list.get(i);
				String name=student.getStuId()+"-"+student.getStuName();
				list2.add(name);
				
			}
			System.out.println(list2);
//			StudentDao studentDao=new StudentDaoImpl();
//			List<Student> list=studentDao.getAll();
			
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		
		
	}
}
